package com.lin.lambda;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;

public class da {
    public static void main(String[] args) {
        // lambda实例化函数式接口
        Student student = ()  -> {
            System.out.println("干啥啥不行,吃饭的一名");
        };
        student.dayWork();
        // lambda表达式引用静态方法
        Info i1=new Info("wangwei", 18);
        Info i2=new Info("lin", 20);
        Info[] infos=new Info[]{i1,i2};
        Info i3=new Info();
//        Arrays.sort(infos, (o1, o2) -> o1.getAge() - o2.getAge());
        Arrays.sort(infos, Info::compareAge);
        for (Info info : infos) {
            System.out.println(info);
        }
        //
        Arrays.sort(infos,i3::compareAge2);
        for (Info info : infos) {
            System.out.println(info);
        }
    }
}
